<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }
        ul {
            list-style: none;
        }
        .wrapper {
            position: relative;
            width: 800px;
            height: 400px;
            margin: 10px auto;
        }
        .wrapper ul li {
            position: absolute;
            height: 400px;
            perspective: 50000px;
            transform-style: preserve-3d;
            transition: all 1s ease;
        }
        .wrapper ul li div {
            position: absolute;
            /* 忘了 */
            width: 100%;
            /* 忘了 */
            height: 400px;
            /* 记得 */
            background-size: 800px 400px;
            /* 忘了 */
        }
        .wrapper ul li div:nth-child(1) {
            background-image: url(img/selda.jpg);
            transform: translateZ(200px);
        }
        .wrapper ul li div:nth-child(2) {
            background-image: url(img/honor.jpg);
            transform: rotateX(-90deg) translateZ(200px);
        }
        .wrapper ul li div:nth-child(3) {
            background-image: url(img/mario.jpg);
            transform: rotateX(-180deg) translateZ(200px);
        }
        .wrapper ul li div:nth-child(4) {
            background-image: url(img/splatoon.jpg);
            transform: rotateX(90deg) translateZ(200px);
        }
        [type="button"] {
            display: block;
            width: 100px;
            height: 50px;
            margin: 10px auto;
        }
    </style>
    <script src="jquery.min.js"></script>
</head>
<body>
    <div class="wrapper">
        <ul>
            
        </ul>
    </div>
    <input type="button" value="下一张">
    <script>
        const $ul = $("ul"), $wrapper = $(".wrapper"), $btn = $('[type="button"]');
        let total = 100, pl = $wrapper.width()/total, delay = 0.01, deg = 0, lock = false;
        console.log(pl)
        for (let i = 0 ; i < total ; i++) {
            let $lis1 = $('<li><div></div><div></div><div></div><div></div></li>').appendTo($ul);
            $lis1.css("width",pl)
        }
        const $lis = $(".wrapper ul li")
        $lis.each(function (i) {
            $(this).css("left",i*pl)
            .children().css("background-position",`${-i*pl}px 0`)
        })

        $btn.click(function () {
            if (lock) {
                return;
            }
            lock = true;
            deg -= 90;
            $lis.each(function (i) {
                $(this).css({
                    "transform": `rotateX(${deg}deg)`,
                    "transition-delay": `${i*delay}s`
                })
            })
            setTimeout(() => {
                lock = false;
            },2000)
        })
    </script>
</body>
</html>